Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electronic storage overhaul demo #79097

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

ShnitzelX2
Copy link
Contributor

Summary

Infrastructure "electronic storage overhaul"

Purpose of change

This is a demo for the implementation of #78043. It should not be merged or undrafted and will be submitted later as several separate PRs. It contains some known bugs, astyle/json formatting not guaranteed, this is a rough draft.

The main goal here is to generalize EBOOK storage to be more usable, visible, and convenient. Additionally, general e-file handling allows for future content.

The existing actions that substitute for the lack of general electronic storage are separately implemented and therefore can't be mass-processed, which means that a lot of the time they -- maps, lore bits, e-books, software, everything on memory cards, etc. -- are ignored for convenience's sake.

And that's bad. E-devices being ignored isn't realistic in our modern world, nor in the Cataclysm, where they should be treasure troves of useful information as opposed to the current method of learning: primarily physical books.

Describe the solution

How does this work?

An e-file is simply an item inside a E_FILE_STORAGE pocket, identically to how the EBOOK pocket acts. While in the pocket, e-files take up ememory_size, up to ememory_max for the pocket. Each usable e-device (smartphone, laptop, e-ink tablet) now has an E_FILE_STORAGE pocket, and removable media devices do as well (USB drive, memory card, cameras, and the new portable hard drive).

This means that e-devices can be spawned with contents: items and/or item groups.

The following file operations are available to the player via the new E_FILE_DEVICE use_action and related efile_activity_actor:

  • Browse reveals the contents of nearby e-devices, allowing for further operations. This is currently equivalent to powering on an e-device then going through its contents, picking out important files, and wiping the rest.
  • Read (from external devices) activates the iuse function for an e-file.
  • Move onto/off moves files to a single e-device or from multiple e-devices.
  • Copy onto/off copies only eligible files to a single e-device or from multiple e-devices. Currently, the only files capable of being copied are manuals. If copies of selected files already exist, they are skipped.
  • Wipe deletes files.
  • Browse + move is a combo call for convenience.
What's reworked?

memory card (unread) and related functions have been generalized:

  • music was not re-implemented because it's identical to smartphone music, which is unlimited and free
  • generic photos were not re-implemented because there are books that do effectively the same thing
  • recipes from memory_card are now stored in a recipe catalog, which auto-combines with other recipe catalogs. Recipe catalogs will be loot on e-devices. Reading a recipe catalog will list its recipes.
  • photos from memory_card are now stored in a photo gallery, which auto-combines with other photo galleries. Reading a photo gallery will view its photos, identically to a camera.

The use_actions for smartphones' map application and local files are now e-files: map cache and questionable media file. They work identically and will be loot on e-devices.

Cameras now are e-storage and still take pictures, but can only view contained photos. You can move photos off of them with the new actions.

Obsoletes ELECTRICSTORAGE, EINKTABLETPC, EBOOKREAD use_actions

Describe alternatives you've considered

Lots! I've iterated over the design a few times on and off for the past month, and this is the result.

But I leave critique up to the community. Merge this for yourself and play around with it, look through the code, etc, and let me know what you think. There's lots of polishing left to do, and lots of things that could be done differently.

Testing

Outside of manual testing, none yet. I'm not writing tests until we've settled on a final design.

SUS/OFFICE has some test e-devices with files on them, so use e.g. light_industry for testing

Additional context

Various screenshots

laptop
edevice_inv
edevice_browse
edevice_copy
edevice_menu
edevice_move
edevice_read

Yet to-dos:

  • test cases
  • computer skill can change mid-activity
  • verify efile_transfer serialization works
  • actually do migration/obsoletion beyond removing use_action json entries for items
    • migrate EBOOK/SOFTWARE -> E_FILE_STORAGE
    • obsolete memory card (unread), data_handling_activity_actor
    • check hardcoded software, memory card
  • item groups for e-devices (lots of data!)

Planned follow-ups:

  • chapters read of unique books should be globally shared amongst all copies
  • map cache centers on spawn location OMT, not current OMT
  • map cache / lore file inventory display "(used)" on read
  • fix "multiple copies of books can be stored to a device" (carry-over from previous e-book system)
  • music efiles?
  • bulk copy (mostly UI issue)

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON Map / Mapgen Overmap, Mapgen, Map extras, Map display Spawn Creatures, items, vehicles, locations appearing on map Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. [Markdown] Markdown issues and PRs Items: Containers Things that hold other things EOC: Effects On Condition Anything concerning Effects On Condition Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style astyled astyled PR, label is assigned by github actions labels Jan 12, 2025
@Maleclypse
Copy link
Member

I want to say I love this design. No real complaints from me

@GuardianDll
Copy link
Member

Also big fan of this piece of content being finally mainstreamed, instead of books using one pocket, usb apps using another pocket, map and snippets using eoc, and photos and music using some totally hardcoded thingy

@ShnitzelX2 ShnitzelX2 force-pushed the e-files-extend-ebooks branch from 4c47e6d to 06647c5 Compare January 17, 2025 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Code: Tests Measurement, self-control, statistics, balancing. <Documentation> Design documents, internal info, guides and help. EOC: Effects On Condition Anything concerning Effects On Condition Info / User Interface Game - player communication, menus, etc. Items: Containers Things that hold other things [JSON] Changes (can be) made in JSON Map / Mapgen Overmap, Mapgen, Map extras, Map display [Markdown] Markdown issues and PRs Monsters Monsters both friendly and unfriendly. Spawn Creatures, items, vehicles, locations appearing on map
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants